package com;


import com.pojo.Student;
import com.util.GetString;

import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.IOException;

public class Main {
    public static void main(String[] args) {
        String fileName = "example.txt"; // 文件名
        String content = "这是一个示例文本文件。\n第二行内容。\n第三行内容。\n";

        try {
            // 创建文件写入器
            FileWriter fileWriter = new FileWriter(fileName);

            // 创建缓冲写入器，可以提高写入性能
            BufferedWriter bufferedWriter = new BufferedWriter(fileWriter);

            // 写入内容
            bufferedWriter.write(content);

            // 关闭写入器
            bufferedWriter.close();

            System.out.println("文本文件已创建并写入成功。");
        } catch ( IOException e) {
            e.printStackTrace();
        }
        Student student = new Student("fang");
        System.out.println(GetString.getJsonString(student));
    }
}
